package com.example.pool;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: dangwen
 * @createDate: 2021/3/16
 */
public class FinalObjectTest {
    private int i;
    private List<Integer> list;
    private InnerFinalUser innerFinalUser;

    public FinalObjectTest(int i){
        this.i = i;
        list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        innerFinalUser = new InnerFinalUser();
        innerFinalUser.setAge("18");
        innerFinalUser.setName("zhangSan");
    }

    public int getI() {
        return i;
    }

    public List<Integer> getList() {
        return list;
    }

    public InnerFinalUser getInnerFinalUser() {
        return innerFinalUser;
    }

    @Data
    class InnerFinalUser{
        String name;
        String age;
    }

    public static void main(String[] args) {
        FinalObjectTest finalObjectTest = new FinalObjectTest(3);
        int i = finalObjectTest.getI();
        System.out.println(i);
        i = 4;
        System.out.println(i);
        System.out.println(finalObjectTest.getI());

        System.out.println("========================================");

        List<Integer> list = finalObjectTest.getList();
        System.out.println(list.toString());
        list.add(4);
        System.out.println(list.toString());
        System.out.println(finalObjectTest.getList());

        System.out.println("========================================");

        InnerFinalUser innerFinalUser = finalObjectTest.getInnerFinalUser();
        System.out.println(innerFinalUser);
        innerFinalUser.setName("lisi");
        innerFinalUser.setAge("99");
        System.out.println(innerFinalUser);
        System.out.println(finalObjectTest.getInnerFinalUser());

    }
}
